% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  pdftitle={Replication materials for Gov 2001 Final Paper: Votes on Fire},
  pdfauthor={Maria Ballesteros, Aleksandra Conevska, Ethan Miles},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1in]{geometry}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering

\title{Replication materials for Gov 2001 Final Paper: Votes on Fire}
\author{Maria Ballesteros, Aleksandra Conevska, Ethan Miles}
\date{December 14, 2020}

\begin{document}
\maketitle

This document replicates the analysis of ``Votes on Fire''.

\hypertarget{data-preparation}{%
\subsection{Data Preparation}\label{data-preparation}}

\begin{verbatim}
## Warning: package 'spDataLarge' is not available (for R version 4.0.2)
\end{verbatim}

\begin{verbatim}
## Warning in p_install(package, character.only = TRUE, ...):
\end{verbatim}

\begin{verbatim}
## Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
## logical.return = TRUE, : there is no package called 'spDataLarge'
\end{verbatim}

\begin{verbatim}
## Warning in pacman::p_load(sf, data.table, lwgeom, RSQLite, MASS, car, tidyverse, : Failed to install/load:
## spDataLarge
\end{verbatim}

\hypertarget{fixing-data-from-ok-county}{%
\subsubsection{Fixing Data from OK
county}\label{fixing-data-from-ok-county}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{################### THIS CHUNK COULD GO IN THE DATA MERGE COMPLETE SCRIPT #########}
\CommentTok{#### getting OK county data from individual data as there appears to be a data entry error. }

\NormalTok{reg_v}\OperatorTok{$}\NormalTok{to2020<-}\StringTok{ }\NormalTok{reg_v}\OperatorTok{$}\NormalTok{voted2020}\OperatorTok{/}\NormalTok{reg_v}\OperatorTok{$}\NormalTok{totalreg}
\CommentTok{## replacing values for OK county with values from Indv level data}
  \CommentTok{## first, droping FullPrc.y and renaming FullPrc.x to FullPrc}
\NormalTok{votefire_}\DecValTok{1620}\NormalTok{<-}\StringTok{ }\NormalTok{votefire_}\DecValTok{1620} \OperatorTok{%>%}
\StringTok{                    }\NormalTok{dplyr}\OperatorTok{::}\KeywordTok{select}\NormalTok{(}\OperatorTok{-}\KeywordTok{c}\NormalTok{(}\StringTok{"FullPrc.y"}\NormalTok{, }\StringTok{"countycode"}\NormalTok{)) }\OperatorTok{%>%}
\StringTok{                    }\KeywordTok{rename}\NormalTok{(}\DataTypeTok{FullPrc =}\NormalTok{ FullPrc.x)}
\NormalTok{reg_v<-}\StringTok{ }\NormalTok{reg_v }\OperatorTok{%>%}\StringTok{ }
\StringTok{                }\NormalTok{dplyr}\OperatorTok{::}\KeywordTok{select}\NormalTok{(}\KeywordTok{c}\NormalTok{(}\StringTok{"FullPrc"}\NormalTok{, }\StringTok{"totalreg"}\NormalTok{, }\StringTok{"voted2020"}\NormalTok{, }\StringTok{"to2020"}\NormalTok{))}
                  
\CommentTok{## generating dataset with OK replaced}
\NormalTok{votefire_}\DecValTok{2}\NormalTok{<-}\StringTok{ }\KeywordTok{left_join}\NormalTok{(votefire_}\DecValTok{1620}\NormalTok{, reg_v, }\DataTypeTok{by =} \StringTok{"FullPrc"}\NormalTok{, }\DataTypeTok{all.x =}\NormalTok{ T)}
\KeywordTok{attach}\NormalTok{(votefire_}\DecValTok{2}\NormalTok{)}

\ControlFlowTok{for}\NormalTok{( i }\ControlFlowTok{in} \DecValTok{1}\OperatorTok{:}\KeywordTok{nrow}\NormalTok{(votefire_}\DecValTok{2}\NormalTok{))\{}
\ControlFlowTok{if}\NormalTok{(CountyName[i] }\OperatorTok{==}\StringTok{ "OK"}\NormalTok{)\{}
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{ballotscast2020[i]<-}\StringTok{  }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{voted2020[i]}
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{regvoters2020[i]<-}\StringTok{    }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{totalreg[i]}
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{turnout2020[i]<-}\StringTok{      }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{to2020[i]}
\NormalTok{\}}
\NormalTok{\}}



\KeywordTok{ggplot}\NormalTok{(votefire_}\DecValTok{2}\NormalTok{)}\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{geom_point}\NormalTok{(}\KeywordTok{aes}\NormalTok{(}\DataTypeTok{x =}\NormalTok{ PrecDist5000Fire_km, }\DataTypeTok{y =}\NormalTok{ turnout2020), }\DataTypeTok{color =} \StringTok{"orangered3"}\NormalTok{, }\DataTypeTok{alpha =} \FloatTok{.4}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{xlim}\NormalTok{(}\DecValTok{0}\NormalTok{,}\DecValTok{300}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{ggtitle}\NormalTok{(}\StringTok{"Precinct Turnout Percentage by Distance from Nearest Fire (KM)"}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{xlab}\NormalTok{(}\StringTok{"Distance from Nearest Fire (KM)"}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{ylab}\NormalTok{(}\StringTok{"Precinct Turnout Percentage"}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{geom_smooth}\NormalTok{(}\DataTypeTok{method =} \StringTok{"lm"}\NormalTok{, }\KeywordTok{aes}\NormalTok{(}\DataTypeTok{x =}\NormalTok{ PrecDist5000Fire_km, }\DataTypeTok{y =}\NormalTok{ turnout2020), }\DataTypeTok{color =} \StringTok{"black"}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{theme_bw}\NormalTok{() }\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{theme}\NormalTok{(}\DataTypeTok{plot.title =} \KeywordTok{element_text}\NormalTok{(}\DataTypeTok{hjust =} \FloatTok{0.5}\NormalTok{)) }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## `geom_smooth()` using formula 'y ~ x'
\end{verbatim}

\begin{verbatim}
## Warning: Removed 258 rows containing non-finite values (stat_smooth).
\end{verbatim}

\begin{verbatim}
## Warning: Removed 258 rows containing missing values (geom_point).
\end{verbatim}

\includegraphics{votefire_analysis_turnout_files/figure-latex/unnamed-chunk-1-1.pdf}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#ggsave("TurnoutByFireDistance.jpeg", path = "/Users/ethan/Dropbox (Harvard University)/Replication/output/Figures")}


\CommentTok{## dropping 2 rogue OK precincts and extra variables}

\NormalTok{votefire_}\DecValTok{2}\NormalTok{<-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2} \OperatorTok{%>%}
\StringTok{                        }\KeywordTok{filter}\NormalTok{(turnout2020}\OperatorTok{<=}\StringTok{ }\DecValTok{1}\NormalTok{) }\OperatorTok{%>%}
\StringTok{                        }\NormalTok{dplyr}\OperatorTok{::}\KeywordTok{select}\NormalTok{(}\OperatorTok{-}\KeywordTok{c}\NormalTok{(}\StringTok{"totalreg"}\NormalTok{, }\StringTok{"voted2020"}\NormalTok{, }\StringTok{"to2020"}\NormalTok{))}


\CommentTok{### ## creating proportion demographic variables}
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{prop_fem<-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{fem}\OperatorTok{/}\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{regvoters2020}
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{prop_under30<-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{age18_}\DecValTok{30}\OperatorTok{/}\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{regvoters2020}


\CommentTok{## creating turnout variables by demographic category}
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{fem_turnout <-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{fem_voted}\OperatorTok{/}\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{fem}
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{male_turnout <-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{male_voted}\OperatorTok{/}\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{male}
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{young_turnout <-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{young_voted}\OperatorTok{/}\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{age18_}\DecValTok{30}

\CommentTok{## selecting complete cases}
\NormalTok{delvars <-}\StringTok{ }\NormalTok{delvars <-}\StringTok{ }\KeywordTok{c}\NormalTok{(}\StringTok{'turnout2016'}\NormalTok{, }\StringTok{'turnout2020'}\NormalTok{, }\StringTok{'BAWithin0to5km'}\NormalTok{,}
             \StringTok{'WHPMean'}\NormalTok{, }\StringTok{'crit_work'}\NormalTok{, }\StringTok{'remindex'}\NormalTok{, }\StringTok{'proximity'}\NormalTok{,}
             \StringTok{'exposure'}\NormalTok{, }\StringTok{'urban'}\NormalTok{, }\StringTok{'FIPS'}\NormalTok{)}
\NormalTok{votefire2_complete <-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2}\NormalTok{[}\KeywordTok{complete.cases}\NormalTok{(votefire_}\DecValTok{2}\NormalTok{[ , delvars]),]}
\NormalTok{FullPrc<-votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc}
\end{Highlighting}
\end{Shaded}

\hypertarget{analysis}{%
\subparagraph{Analysis}\label{analysis}}

\hypertarget{table-1}{%
\subsection{Table 1}\label{table-1}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{# Creating lengths for cluster robust se }
\NormalTok{G <-}\StringTok{ }\KeywordTok{length}\NormalTok{(}\KeywordTok{unique}\NormalTok{(votefire2_complete}\OperatorTok{$}\NormalTok{CountyCode)) }
\NormalTok{N <-}\StringTok{ }\KeywordTok{length}\NormalTok{(votefire2_complete}\OperatorTok{$}\NormalTok{CountyCode)}

\CommentTok{# model 1 - binary iv, no turnout trend, controls, no fixed effects}
\NormalTok{m1 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{        turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{BAWithin0to5km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}\StringTok{ }
\StringTok{        }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop, }
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{dfa1 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m1}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov1 <-}\StringTok{ }\NormalTok{dfa1 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m1, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m1_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m1, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov1)}\CommentTok{# run models with clustered SE}



\CommentTok{# model 2 - binary iv, turnout trend, controls, no fixed effects}
\NormalTok{m2 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{       turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{BAWithin0to5km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{turnout2016 }\OperatorTok{+}
\StringTok{       }\NormalTok{crit_work }\OperatorTok{+}\StringTok{ }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop, }
       \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{dfa2 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m2}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov2 <-}\StringTok{ }\NormalTok{dfa2 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m2, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m2_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m2, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov2)}\CommentTok{# run models with clustered SE}


\CommentTok{# model 3 - binary iv, turnout trend, no controls,  fixed effects}

\CommentTok{# m3_rob = lm_robust(}
\CommentTok{#  turnout2020 ~ BAWithin0to5km  + WHPMean + turnout2016,}
 \CommentTok{# fixed_effects = ~ CountyCode,}
\CommentTok{#  cluster = CountyCode,}
\CommentTok{#  se_type = "CR0",}
\CommentTok{#  data = votefire2_complete}
\CommentTok{#)}

\NormalTok{m3 <-}\StringTok{ }\KeywordTok{lm}\NormalTok{(turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{BAWithin0to5km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{turnout2016 }\OperatorTok{+}\StringTok{ }\KeywordTok{factor}\NormalTok{(CountyCode),}
          \DataTypeTok{data =}\NormalTok{ votefire2_complete)}
\NormalTok{dfa3 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m3}\OperatorTok{$}\NormalTok{df.residual }\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov3 <-}\StringTok{ }\NormalTok{dfa3 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m3, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m3_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m3, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov3)}\CommentTok{# run models with clustered SE}


\CommentTok{## PLM m3 <- plm(turnout2020 ~ BAWithin0to5km  + WHPMean + turnout2016,}
\CommentTok{#          data = votefire2_complete, }
\CommentTok{#          model = 'within', }
\CommentTok{#          index = c('CountyCode'))}


\NormalTok{dfa3 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m3}\OperatorTok{$}\NormalTok{df.residual }\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov3 <-}\StringTok{ }\NormalTok{dfa3 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m3, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m3_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m3, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov3)}\CommentTok{# run models with clustered SE}


\CommentTok{# model 4 -  continuous iv, no turnout trend, covid controls,  no fixed effects }
\NormalTok{m4 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop,}
  \DataTypeTok{data =}\NormalTok{ votefire2_complete}
\NormalTok{) }

\NormalTok{dfa4 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m4}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov4 <-}\StringTok{ }\NormalTok{dfa4 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m4, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m4_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m4, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov4)}\CommentTok{# run models with clustered SE}





\CommentTok{# model 5 - continuous iv, turnout trend, covid controls, no fixed effects}
\NormalTok{m5 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{turnout2016 }\OperatorTok{+}
\StringTok{    }\NormalTok{crit_work }\OperatorTok{+}\StringTok{ }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop,}
  \DataTypeTok{data =}\NormalTok{ votefire2_complete}
\NormalTok{)}

\NormalTok{dfa5 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m5}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov5 <-}\StringTok{ }\NormalTok{dfa5 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m5, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m5_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m5, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov5)}\CommentTok{# run models with clustered SE}




\CommentTok{# model 6 -  continuous iv, turnout trend, no covid controls,  fixed effects}


\CommentTok{#m6_rob = lm_robust(}
 \CommentTok{# turnout2020 ~ PrecDist5000Fire_km  + WHPMean + turnout2016,}
\CommentTok{#  fixed_effects = ~ CountyCode,}
\CommentTok{#  cluster = CountyCode,}
\CommentTok{#  se_type = "CR0",}
\CommentTok{#  data = votefire2_complete}
\CommentTok{#)}

\CommentTok{# THIS WORKS INSTEAD OF LM_ROBUST. PRODUCES THE SAME SE AND COEFFS ALMOST EXACTLY. MIGHT WANT TO JUST USE THIS INSTEAD OF TRYING TO GET LM_ROBUST TO WORK}
\CommentTok{# IN STARGAZER. IF EVERYONE AGREES WE CAN JUST QUICKLY CHANGE THE CODE }

\CommentTok{## PLM m6 <- plm(turnout2020 ~ PrecDist5000Fire_km  + WHPMean + turnout2016, data = votefire2_complete, model = 'within', index = c('CountyCode'))}

\NormalTok{m6 <-}\StringTok{ }\KeywordTok{lm}\NormalTok{(turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{turnout2016 }\OperatorTok{+}\StringTok{ }\KeywordTok{factor}\NormalTok{(CountyCode), }\DataTypeTok{data =}\NormalTok{ votefire2_complete)}

\NormalTok{dfa6 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m6}\OperatorTok{$}\NormalTok{df.residual }\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov6 <-}\StringTok{ }\NormalTok{dfa6 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m6, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m6_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m6, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov6)}\CommentTok{# run models with clustered SE}


\CommentTok{#### on how to add lm_robust objects to stargazer: https://declaredesign.org/r/estimatr/articles/regression-tables.html}
\end{Highlighting}
\end{Shaded}

\hypertarget{stargazer-tables}{%
\subsection{Stargazer tables}\label{stargazer-tables}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{## }

\KeywordTok{stargazer}\NormalTok{(m1, m2, m3, m4, m5, m6,}
           \DataTypeTok{se =} \KeywordTok{starprep}\NormalTok{(m1, m2, m3, m4, m5, m6, }
                         \DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{),}
          \DataTypeTok{header =} \OtherTok{FALSE}\NormalTok{,}
          \DataTypeTok{df=}\OtherTok{FALSE}\NormalTok{, }
          \DataTypeTok{style =} \StringTok{"apsr"}\NormalTok{,}
          \DataTypeTok{title =} \StringTok{"Main result with different measure of fire exposure"}\NormalTok{,}
          \DataTypeTok{omit =} \KeywordTok{c}\NormalTok{(}\StringTok{"WHPMean"}\NormalTok{, }\StringTok{"crit_work"}\NormalTok{, }\StringTok{"remindex"}\NormalTok{, }\StringTok{"proximity"}\NormalTok{,}
                   \StringTok{"exposure"}\NormalTok{, }\StringTok{"urban"}\NormalTok{, }\StringTok{"pop"}\NormalTok{, }\StringTok{"turnout2020"}\NormalTok{, }\StringTok{"Constant"}\NormalTok{, }\StringTok{"CountyCode"}\NormalTok{),}
          \DataTypeTok{add.lines =} \KeywordTok{list}\NormalTok{(}\KeywordTok{c}\NormalTok{(}\StringTok{"County FE"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{), }
                           \KeywordTok{c}\NormalTok{(}\StringTok{"Controls"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{)),}
          \DataTypeTok{covariate.labels =} \KeywordTok{c}\NormalTok{(}\StringTok{"Fire within 0-5km"}\NormalTok{, }\StringTok{"Distance to nearest fire"}\NormalTok{),}
          \DataTypeTok{dep.var.caption =} \StringTok{"Turnout 2020 (mean = ; sd = 0."}\NormalTok{,}
          \DataTypeTok{keep.stat =} \KeywordTok{c}\NormalTok{(}\StringTok{"rsq"}\NormalTok{, }\StringTok{"n"}\NormalTok{),}
          \DataTypeTok{digits =} \DecValTok{3}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{table}[!htbp] \centering 
  \caption{Main result with different measure of fire exposure} 
  \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lcccccc} 
\\[-1.8ex]\hline \\[-1.8ex] 
\\[-1.8ex] & \multicolumn{6}{c}{turnout2020} \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6)\\ 
\hline \\[-1.8ex] 
 Fire within 0-5km & $-$0.002 & 0.001 & 0.010 &  &  &  \\ 
  & (0.012) & (0.010) & (0.010) &  &  &  \\ 
  Distance to nearest fire &  &  &  & 0.0002$^{***}$ & 0.0001$^{***}$ & $-$0.0003$^{***}$ \\ 
  &  &  &  & (0.00003) & (0.00002) & (0.0001) \\ 
  turnout2016 &  & 0.415$^{***}$ & 0.404$^{***}$ &  & 0.414$^{***}$ & 0.404$^{***}$ \\ 
  &  & (0.022) & (0.022) &  & (0.022) & (0.022) \\ 
 County FE &  &  & X &  &  & X \\ 
Controls & X & X &  & X & X &  \\ 
N & 6,768 & 6,768 & 6,768 & 6,768 & 6,768 & 6,768 \\ 
R$^{2}$ & 0.046 & 0.407 & 0.440 & 0.051 & 0.410 & 0.443 \\ 
\hline \\[-1.8ex] 
\multicolumn{7}{l}{$^{*}$p $<$ .1; $^{**}$p $<$ .05; $^{***}$p $<$ .01} \\ 
\end{tabular} 
\end{table}

\hypertarget{testing-turnout-change}{%
\subsection{Testing turnout change}\label{testing-turnout-change}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#Creating vote change variable }
\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{turnout_change <-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{turnout2020 }\OperatorTok{-}\StringTok{ }\NormalTok{votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{turnout2016}
\KeywordTok{summary}\NormalTok{(votefire_}\DecValTok{2}\OperatorTok{$}\NormalTok{turnout_change)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
\end{verbatim}

-0.81028 0.02809 0.05321 0.05735 0.07949 1.00000

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#running without fixed effects }
\NormalTok{m7 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout_change }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop,}
  \DataTypeTok{data =}\NormalTok{ votefire_}\DecValTok{2}
\NormalTok{) }

\NormalTok{dfa7 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m7}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov7 <-}\StringTok{ }\NormalTok{dfa7 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m7, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m7_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m7, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov7)}\CommentTok{# run models with clustered SE}


\CommentTok{#running with fixed effects}
\NormalTok{m8 =}\StringTok{ }\KeywordTok{lm_robust}\NormalTok{(}
\NormalTok{  turnout_change }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean,}
  \DataTypeTok{fixed_effects =} \OperatorTok{~}\StringTok{ }\NormalTok{CountyCode,}
  \DataTypeTok{cluster =}\NormalTok{ CountyCode,}
  \DataTypeTok{se_type =} \StringTok{"CR0"}\NormalTok{,}
  \DataTypeTok{data =}\NormalTok{ votefire_}\DecValTok{2}
\NormalTok{)}


\CommentTok{## Fixed effects, in lm form (vs lm_robust) }
\NormalTok{m8 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout_change }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\KeywordTok{factor}\NormalTok{(CountyCode),}
  \DataTypeTok{data =}\NormalTok{ votefire_}\DecValTok{2}
\NormalTok{) }


\NormalTok{dfa8 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{m8}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcov8 <-}\StringTok{ }\NormalTok{dfa8 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(m8, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{m8_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(m8, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcov8)}\CommentTok{# run models with clustered SE}


\CommentTok{## is this the correct setup for SEs?}
\KeywordTok{stargazer}\NormalTok{(m7, m8,}
           \DataTypeTok{se =} \KeywordTok{starprep}\NormalTok{(m7, m8, }
                         \DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{),}
          \DataTypeTok{header =} \OtherTok{FALSE}\NormalTok{,}
          \DataTypeTok{df=}\OtherTok{FALSE}\NormalTok{, }
          \DataTypeTok{style =} \StringTok{"apsr"}\NormalTok{,}
          \DataTypeTok{title =} \StringTok{"Turnout Change"}\NormalTok{,}
          \DataTypeTok{omit =} \KeywordTok{c}\NormalTok{(}\StringTok{"WHPMean"}\NormalTok{, }\StringTok{"crit_work"}\NormalTok{, }\StringTok{"remindex"}\NormalTok{, }\StringTok{"proximity"}\NormalTok{,}
                   \StringTok{"exposure"}\NormalTok{, }\StringTok{"urban"}\NormalTok{, }\StringTok{"pop"}\NormalTok{, }\StringTok{"turnout2020"}\NormalTok{, }\StringTok{"Constant"}\NormalTok{, }\StringTok{"CountyCode"}\NormalTok{),}
          \DataTypeTok{add.lines =} \KeywordTok{list}\NormalTok{(}\KeywordTok{c}\NormalTok{(}\StringTok{"County FE"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{), }
                           \KeywordTok{c}\NormalTok{(}\StringTok{"Controls"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{)),}
          \DataTypeTok{dep.var.caption =} \StringTok{"Turnout 2020 (mean = ; sd = 0."}\NormalTok{,}
          \DataTypeTok{keep.stat =} \KeywordTok{c}\NormalTok{(}\StringTok{"rsq"}\NormalTok{, }\StringTok{"n"}\NormalTok{),}
          \DataTypeTok{digits =} \DecValTok{3}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{table}[!htbp] \centering 
  \caption{Turnout Change} 
  \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lcc} 
\\[-1.8ex]\hline \\[-1.8ex] 
\\[-1.8ex] & \multicolumn{2}{c}{turnout\_change} \\ 
\\[-1.8ex] & (1) & (2)\\ 
\hline \\[-1.8ex] 
 PrecDist5000Fire\_km & 0.0001$^{**}$ & $-$0.0004$^{***}$ \\ 
  & (0.00003) & (0.0001) \\ 
 County FE &  & X \\ 
Controls & X & X \\ 
N & 6,768 & 6,768 \\ 
R$^{2}$ & 0.014 & 0.039 \\ 
\hline \\[-1.8ex] 
\multicolumn{3}{l}{$^{*}$p $<$ .1; $^{**}$p $<$ .05; $^{***}$p $<$ .01} \\ 
\end{tabular} 
\end{table}

\hypertarget{creating-model-with-demographic-controls}{%
\subsection{creating model with demographic
controls}\label{creating-model-with-demographic-controls}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{### first, creating percent female and percent age}


\NormalTok{m4 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{        turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}\StringTok{ }
\StringTok{        }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop, }
        \DataTypeTok{data =}\NormalTok{ votefire2_complete)}

\NormalTok{c1<-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\NormalTok{prop_under30,}
  \DataTypeTok{data =}\NormalTok{ votefire2_complete}
\NormalTok{) }


\NormalTok{c2<-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\NormalTok{prop_fem,}
  \DataTypeTok{data =}\NormalTok{ votefire2_complete}
\NormalTok{) }


\NormalTok{c3<-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\NormalTok{prop_under30}\OperatorTok{*}\NormalTok{prop_fem,}
  \DataTypeTok{data =}\NormalTok{ votefire2_complete}
\NormalTok{) }


\KeywordTok{stargazer}\NormalTok{(}
\NormalTok{  m4, c1, c2, c3,}
  \DataTypeTok{se =} \KeywordTok{starprep}\NormalTok{(m4, c1, c2, c3, }
                \DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{), }
          \DataTypeTok{header =} \OtherTok{FALSE}\NormalTok{,}
          \DataTypeTok{df=}\OtherTok{FALSE}\NormalTok{, }
          \DataTypeTok{style =} \StringTok{"apsr"}\NormalTok{,}
          \DataTypeTok{title =} \StringTok{"Main result with different measure of fire exposure"}\NormalTok{,}
          \DataTypeTok{omit =} \KeywordTok{c}\NormalTok{(}\StringTok{"WHPMean"}\NormalTok{, }\StringTok{"crit_work"}\NormalTok{, }\StringTok{"remindex"}\NormalTok{, }\StringTok{"proximity"}\NormalTok{,}
                   \StringTok{"exposure"}\NormalTok{, }\StringTok{"urban"}\NormalTok{, }\StringTok{"pop"}\NormalTok{, }\StringTok{"turnout2020"}\NormalTok{, }\StringTok{"Constant"}\NormalTok{),}
          \DataTypeTok{column.labels =} \KeywordTok{c}\NormalTok{(}\StringTok{"Baseline"}\NormalTok{, }\StringTok{"Baseline w Gender"}\NormalTok{, }\StringTok{"Baseline w young"}\NormalTok{, }\StringTok{"Baseline w age \textbackslash{} gender"}\NormalTok{),}
          \DataTypeTok{covariate.labels =} \KeywordTok{c}\NormalTok{( }\StringTok{"Distance to nearest fire"}\NormalTok{),}
          \DataTypeTok{dep.var.caption =} \StringTok{"Turnout 2020 (mean = ; sd = 0."}\NormalTok{,}
          \DataTypeTok{keep.stat =} \KeywordTok{c}\NormalTok{(}\StringTok{"rsq"}\NormalTok{, }\StringTok{"n"}\NormalTok{),}
          \DataTypeTok{digits =} \DecValTok{3}
\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{table}[!htbp] \centering 
  \caption{Main result with different measure of fire exposure} 
  \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lcccc} 
\\[-1.8ex]\hline \\[-1.8ex] 
\\[-1.8ex] & \multicolumn{4}{c}{turnout2020} \\ 
 & Baseline & Baseline w Gender & Baseline w young & Baseline w age  gender \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4)\\ 
\hline \\[-1.8ex] 
 Distance to nearest fire & 0.0002$^{***}$ & 0.0001$^{***}$ & 0.0002$^{***}$ & 0.0001$^{***}$ \\ 
  & (0.00003) & (0.00003) & (0.00003) & (0.00003) \\ 
  prop\_under30 &  & $-$0.167$^{***}$ &  & $-$0.342$^{***}$ \\ 
  &  & (0.059) &  & (0.026) \\ 
  prop\_fem &  &  & $-$0.237$^{***}$ & $-$0.241$^{***}$ \\ 
  &  &  & (0.088) & (0.069) \\ 
  prop\_under30:prop\_fem &  &  &  & 0.121$^{***}$ \\ 
  &  &  &  & (0.012) \\ 
 N & 6,768 & 6,768 & 6,768 & 6,768 \\ 
R$^{2}$ & 0.051 & 0.157 & 0.093 & 0.248 \\ 
\hline \\[-1.8ex] 
\multicolumn{5}{l}{$^{*}$p $<$ .1; $^{**}$p $<$ .05; $^{***}$p $<$ .01} \\ 
\end{tabular} 
\end{table}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#### Removing cases where age is missing #only 2#}
\NormalTok{delvars <-}\StringTok{ }\NormalTok{delvars <-}\StringTok{ }\KeywordTok{c}\NormalTok{(}\StringTok{"fem_turnout"}\NormalTok{, }\StringTok{"young_turnout"}\NormalTok{, }\StringTok{"male_turnout"}\NormalTok{)}
             
\NormalTok{votefire_dem <-}\StringTok{ }\NormalTok{votefire2_complete[}\KeywordTok{complete.cases}\NormalTok{(votefire2_complete[ , delvars]),]}

\NormalTok{M4 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{        turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}\StringTok{ }
\StringTok{        }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop, }
        \DataTypeTok{data =}\NormalTok{ votefire_dem)}
\NormalTok{c4 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{        fem_turnout }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}\StringTok{ }
\StringTok{        }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\NormalTok{prop_fem, }
        \DataTypeTok{data =}\NormalTok{ votefire_dem)}
\NormalTok{c5<-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  male_turnout }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}\StringTok{ }\NormalTok{prop_fem }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop,}
  \DataTypeTok{data =}\NormalTok{ votefire_dem}
\NormalTok{) }


\NormalTok{c6<-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  young_turnout }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\NormalTok{prop_under30,}
  \DataTypeTok{data =}\NormalTok{ votefire_dem}
\NormalTok{) }

\KeywordTok{stargazer}\NormalTok{(}
\NormalTok{  M4, c4, c5, c6,}
  \DataTypeTok{se =} \KeywordTok{starprep}\NormalTok{(M4, c4, c5, c6, }
                \DataTypeTok{clusters =}\NormalTok{ votefire_dem}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{), }
          \DataTypeTok{header =} \OtherTok{FALSE}\NormalTok{,}
          \DataTypeTok{df=}\OtherTok{FALSE}\NormalTok{, }
          \DataTypeTok{style =} \StringTok{"apsr"}\NormalTok{,}
          \DataTypeTok{title =} \StringTok{"Main result with different measure of fire exposure"}\NormalTok{,}
          \DataTypeTok{omit =} \KeywordTok{c}\NormalTok{(}\StringTok{"WHPMean"}\NormalTok{, }\StringTok{"crit_work"}\NormalTok{, }\StringTok{"remindex"}\NormalTok{, }\StringTok{"proximity"}\NormalTok{,}
                   \StringTok{"exposure"}\NormalTok{, }\StringTok{"urban"}\NormalTok{, }\StringTok{"pop"}\NormalTok{, }\StringTok{"turnout2020"}\NormalTok{, }\StringTok{"Constant"}\NormalTok{),}
          \DataTypeTok{column.labels =} \KeywordTok{c}\NormalTok{(}\StringTok{"Baseline"}\NormalTok{, }\StringTok{"Turnout: Female Voters"}\NormalTok{, }\StringTok{"Turnout:Male Voters"}\NormalTok{, }\StringTok{"Turnout: age 30 and under"}\NormalTok{),}
          \DataTypeTok{covariate.labels =} \KeywordTok{c}\NormalTok{( }\StringTok{"Distance to nearest fire"}\NormalTok{),}
          \DataTypeTok{dep.var.caption =} \StringTok{"Turnout 2020 (mean = ; sd = 0."}\NormalTok{,}
          \DataTypeTok{keep.stat =} \KeywordTok{c}\NormalTok{(}\StringTok{"rsq"}\NormalTok{, }\StringTok{"n"}\NormalTok{),}
          \DataTypeTok{digits =} \DecValTok{3}
\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{table}[!htbp] \centering 
  \caption{Main result with different measure of fire exposure} 
  \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lcccc} 
\\[-1.8ex]\hline \\[-1.8ex] 
\\[-1.8ex] & turnout2020 & fem\_turnout & male\_turnout & young\_turnout \\ 
 & Baseline & Turnout: Female Voters & Turnout:Male Voters & Turnout: age 30 and under \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4)\\ 
\hline \\[-1.8ex] 
 Distance to nearest fire & 0.0002$^{***}$ & 0.0001$^{***}$ & 0.0001$^{***}$ & $-$0.0001$^{***}$ \\ 
  & (0.00003) & (0.00003) & (0.00004) & (0.00004) \\ 
  prop\_fem &  & $-$0.520$^{***}$ & $-$0.500$^{***}$ &  \\ 
  &  & (0.129) & (0.133) &  \\ 
  prop\_under30 &  &  &  & $-$0.185$^{***}$ \\ 
  &  &  &  & (0.042) \\ 
 N & 6,733 & 6,733 & 6,733 & 6,733 \\ 
R$^{2}$ & 0.056 & 0.202 & 0.152 & 0.230 \\ 
\hline \\[-1.8ex] 
\multicolumn{5}{l}{$^{*}$p $<$ .1; $^{**}$p $<$ .05; $^{***}$p $<$ .01} \\ 
\end{tabular} 
\end{table}

\hypertarget{testing-if-whp-predicts-fires}{%
\subsection{Testing if WHP predicts
fires}\label{testing-if-whp-predicts-fires}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{WHP_test <-}\StringTok{ }\KeywordTok{plm}\NormalTok{(BASqMSum }\OperatorTok{~}\StringTok{ }\NormalTok{WHPMean, }\DataTypeTok{data =}\NormalTok{ votefire2_complete, }\DataTypeTok{model =} \StringTok{'within'}\NormalTok{, }\DataTypeTok{index =} \KeywordTok{c}\NormalTok{(}\StringTok{'CountyCode'}\NormalTok{))}

\NormalTok{dfatest <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{WHP_test}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcovtest <-}\StringTok{ }\NormalTok{dfatest }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(WHP_test, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{WHPtest_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(WHP_test, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcovtest)}\CommentTok{# run models with clustered SE}


\KeywordTok{stargazer}\NormalTok{(}
\NormalTok{  WHPtest_r,}
          \DataTypeTok{header =} \OtherTok{FALSE}\NormalTok{,}
          \DataTypeTok{df=}\OtherTok{FALSE}\NormalTok{, }
          \DataTypeTok{style =} \StringTok{"apsr"}\NormalTok{,}
          \DataTypeTok{title =} \StringTok{"Testing relationship between fire vulnerability and burned area"}\NormalTok{,}
          \DataTypeTok{omit =} \KeywordTok{c}\NormalTok{(}\StringTok{"Constant"}\NormalTok{),}
          \DataTypeTok{column.labels =} \KeywordTok{c}\NormalTok{(}\StringTok{"Burned Area (Sq m)"}\NormalTok{),}
          \DataTypeTok{covariate.labels =} \KeywordTok{c}\NormalTok{(}\StringTok{"Wildfire Hazard Potential"}\NormalTok{),}
          \DataTypeTok{dep.var.caption =} \StringTok{""}\NormalTok{,}
          \DataTypeTok{keep.stat =} \KeywordTok{c}\NormalTok{(}\StringTok{"rsq"}\NormalTok{, }\StringTok{"n"}\NormalTok{),}
          \DataTypeTok{digits =} \DecValTok{3}
\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## 
## \begin{table}[!htbp] \centering 
##   \caption{Testing relationship between fire vulnerability and burned area} 
##   \label{} 
## \begin{tabular}{@{\extracolsep{5pt}}lc} 
## \\[-1.8ex]\hline \\[-1.8ex] 
## \\[-1.8ex] &   \\ 
##  & Burned Area (Sq m) \\ 
## \hline \\[-1.8ex] 
##  Wildfire Hazard Potential & 1,212.155 \\ 
##   & (1,330.625) \\ 
##  \hline \\[-1.8ex] 
## \multicolumn{2}{l}{$^{*}$p $<$ .1; $^{**}$p $<$ .05; $^{***}$p $<$ .01} \\ 
## \end{tabular} 
## \end{table}
\end{verbatim}

\hypertarget{figure-x-map-of-wildfire}{%
\subsection{Figure X: Map of Wildfire}\label{figure-x-map-of-wildfire}}

\begin{verbatim}
## Warning in sp::proj4string(obj): CRS object has comment, which is lost in output
\end{verbatim}

\includegraphics{votefire_analysis_turnout_files/figure-latex/unnamed-chunk-7-1.pdf}

\begin{verbatim}
## Warning in sp::proj4string(obj): CRS object has comment, which is lost in output
\end{verbatim}

\begin{verbatim}
## Map saved to /Users/mariaballesteros/Dropbox/Harvard/G1/GOV 2001/Replication/output/Figures/washfire_map_ac
\end{verbatim}

\begin{verbatim}
## Resolution: 3200 by 2540 pixels
\end{verbatim}

\begin{verbatim}
## Size: 9.142857 by 7.257143 inches (350 dpi)
\end{verbatim}

\hypertarget{figure-x-main-results-with-different-measures-of-fire-exposure}{%
\subsection{Figure X: Main results with different measures of fire
exposure}\label{figure-x-main-results-with-different-measures-of-fire-exposure}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{### Ethan  }\AlertTok{###}\CommentTok{ this plot needs confidence intervals}
\NormalTok{distlist.granular =}\StringTok{ }\KeywordTok{seq}\NormalTok{(}\DataTypeTok{from=}\DecValTok{5}\NormalTok{, }\DataTypeTok{to=}\DecValTok{40}\NormalTok{, }\DataTypeTok{by=}\DecValTok{5}\NormalTok{)}

\NormalTok{f.reltomedian =}\StringTok{ }\KeywordTok{as.formula}\NormalTok{(}\StringTok{"turnout2020~BAWithin0to5km + BAWithin5to10km + }
\StringTok{        BAWithin10to15km + BAWithin15to20km + BAWithin20to25km +}
\StringTok{        BAWithin25to30km + BAWithin30to35km + BAWithinOver40km +}
\StringTok{        turnout2020 +  WHPMean "}\NormalTok{)}


\NormalTok{lmr.reltomedian =}\StringTok{ }\KeywordTok{lm}\NormalTok{(}
                   \DataTypeTok{formula =}\NormalTok{ f.reltomedian, }
                   \DataTypeTok{data=}\NormalTok{votefire_}\DecValTok{2}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## Warning in model.matrix.default(mt, mf, contrasts): the response appeared on the
## right-hand side and was dropped
\end{verbatim}

\begin{verbatim}
## Warning in model.matrix.default(mt, mf, contrasts): problem with term 9 in
## model.matrix: no columns are assigned
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{coef.reltomedian =}\StringTok{ }\KeywordTok{summary}\NormalTok{(lmr.reltomedian)}\OperatorTok{$}\NormalTok{coef}


\CommentTok{# Regresion table to accompany figure - could go in Appendix }
\KeywordTok{rownames}\NormalTok{(coef.reltomedian)=}\StringTok{ }
\StringTok{  }\KeywordTok{c}\NormalTok{(}\StringTok{"Fire within 0-5km"}\NormalTok{,}\StringTok{"Fire within 5-10km"}\NormalTok{, }\StringTok{"Fire within 10-15km"}\NormalTok{,}
    \StringTok{"Fire within 15-20km"}\NormalTok{,}\StringTok{"Fire within 20-25km"}\NormalTok{,}\StringTok{"Fire within 25-30km"}\NormalTok{,}
    \StringTok{"Fire within 30-35km"}\NormalTok{, }\StringTok{"Fire over 40km away"}\NormalTok{, }
    \StringTok{"Voter turnout 2016"}\NormalTok{, }\StringTok{"Fire Vulnerability"}\NormalTok{)}

\NormalTok{xtable}\OperatorTok{::}\KeywordTok{xtable}\NormalTok{(coef.reltomedian[}\DecValTok{1}\OperatorTok{:}\DecValTok{10}\NormalTok{,}\DecValTok{1}\OperatorTok{:}\DecValTok{4}\NormalTok{], }\DataTypeTok{digits =} \DecValTok{3}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## % latex table generated in R 4.0.2 by xtable 1.8-4 package
## % Mon Dec 14 11:34:10 2020
## \begin{table}[ht]
## \centering
## \begin{tabular}{rrrrr}
##   \hline
##  & Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\ 
##   \hline
## Fire within 0-5km & 0.801 & 0.006 & 143.943 & 0.000 \\ 
##   Fire within 5-10km & 0.029 & 0.011 & 2.533 & 0.011 \\ 
##   Fire within 10-15km & 0.055 & 0.016 & 3.437 & 0.001 \\ 
##   Fire within 15-20km & 0.021 & 0.011 & 1.925 & 0.054 \\ 
##   Fire within 20-25km & 0.022 & 0.010 & 2.104 & 0.035 \\ 
##   Fire within 25-30km & 0.013 & 0.008 & 1.587 & 0.113 \\ 
##   Fire within 30-35km & -0.027 & 0.008 & -3.155 & 0.002 \\ 
##   Fire over 40km away & 0.031 & 0.008 & 3.862 & 0.000 \\ 
##   Voter turnout 2016 & 0.047 & 0.006 & 8.423 & 0.000 \\ 
##   Fire Vulnerability & 0.000 & 0.000 & 5.528 & 0.000 \\ 
##    \hline
## \end{tabular}
## \end{table}
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{# Prepare for plotting }
\NormalTok{whichdistances =}\StringTok{ }\NormalTok{distlist.granular[}\DecValTok{1}\OperatorTok{:}\DecValTok{8}\NormalTok{]}
\NormalTok{numdistances =}\StringTok{ }\KeywordTok{length}\NormalTok{(whichdistances)}
\NormalTok{coefs.intervals =}\StringTok{ }\NormalTok{coef.reltomedian[}\DecValTok{1}\OperatorTok{:}\NormalTok{numdistances,}\DecValTok{1}\NormalTok{]}
\NormalTok{ses.intervals =}\StringTok{ }\NormalTok{coef.reltomedian[}\DecValTok{1}\OperatorTok{:}\NormalTok{numdistances,}\DecValTok{2}\NormalTok{]}

\NormalTok{plot.dat =}\StringTok{ }\KeywordTok{data.frame}\NormalTok{(coefs.intervals, ses.intervals, }\DataTypeTok{ub=}\NormalTok{coefs.intervals}\FloatTok{+2.58}\OperatorTok{*}\NormalTok{ses.intervals, }
                      \DataTypeTok{lb =}\NormalTok{ coefs.intervals}\FloatTok{-2.58}\OperatorTok{*}\NormalTok{ses.intervals, }\DataTypeTok{dist=}\NormalTok{whichdistances)}

\NormalTok{g =}\StringTok{ }\KeywordTok{ggplot}\NormalTok{(plot.dat, }\KeywordTok{aes}\NormalTok{(}\DataTypeTok{y=}\NormalTok{coefs.intervals, }\DataTypeTok{x=}\NormalTok{dist, }\DataTypeTok{color =} \KeywordTok{I}\NormalTok{(}\StringTok{"orangered3"}\NormalTok{), }\DataTypeTok{alpha =} \FloatTok{.4}\NormalTok{)) }\OperatorTok{+}
\StringTok{    }\KeywordTok{geom_point}\NormalTok{() }\OperatorTok{+}\StringTok{ }
\StringTok{    }\KeywordTok{theme_bw}\NormalTok{() }\OperatorTok{+}\StringTok{ }
\StringTok{    }\KeywordTok{geom_errorbar}\NormalTok{(}\KeywordTok{aes}\NormalTok{(}\DataTypeTok{ymin=}\NormalTok{lb,}\DataTypeTok{ymax=}\NormalTok{ub), }\DataTypeTok{color =} \StringTok{"black"}\NormalTok{, }\DataTypeTok{width=}\FloatTok{0.1}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{    }\KeywordTok{labs}\NormalTok{(}\DataTypeTok{x=}\StringTok{"Distance from nearest wildfire (km)"}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{    }\KeywordTok{scale_y_continuous}\NormalTok{(}\DataTypeTok{name=}\StringTok{"Estimated effect of wildfire on turnout"}\NormalTok{, }\DataTypeTok{limits=}\KeywordTok{c}\NormalTok{(}\OperatorTok{-}\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{)) }\OperatorTok{+}\StringTok{ }
\StringTok{    }\KeywordTok{geom_hline}\NormalTok{(}\DataTypeTok{yintercept =} \DecValTok{0}\NormalTok{) }\OperatorTok{+}
\StringTok{    }\KeywordTok{geom_pointrange}\NormalTok{(}\KeywordTok{aes}\NormalTok{(}\DataTypeTok{ymin=}\NormalTok{lb, }\DataTypeTok{ymax=}\NormalTok{ub)) }\OperatorTok{+}\StringTok{ }
\StringTok{    }\KeywordTok{theme}\NormalTok{(}\DataTypeTok{legend.position =} \StringTok{"none"}\NormalTok{)}



\NormalTok{g }\OperatorTok{+}\StringTok{ }\KeywordTok{scale_x_continuous}\NormalTok{(}\DataTypeTok{breaks=}\KeywordTok{seq}\NormalTok{(}\DecValTok{10}\NormalTok{,}\DecValTok{40}\NormalTok{,}\DecValTok{10}\NormalTok{), }
                       \DataTypeTok{labels=}\KeywordTok{c}\NormalTok{(}\StringTok{"5-10 km"}\NormalTok{,}\StringTok{"15-20 km"}\NormalTok{,}\StringTok{"25-30 km"}\NormalTok{,}\StringTok{"30-35 km"}\NormalTok{))}
\end{Highlighting}
\end{Shaded}

\includegraphics{votefire_analysis_turnout_files/figure-latex/unnamed-chunk-8-1.pdf}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#ggsave("Effect_Of_Fire_On_Turnout.jpeg", path = "/Users/ethan/Dropbox (Harvard University)/Replication/output/Figures")}


\CommentTok{#dev.off()}
\CommentTok{#ggsave(filename = "fig_dist_reltomedian.jpg", plot = last_plot(), }
       \CommentTok{#device = "jpeg", path = "figures",}
      \CommentTok{# width = 6, height = 4, units = "in")}
\end{Highlighting}
\end{Shaded}

\#\#Running additional models and robustness checks

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{## Set working directory}
\CommentTok{#Aleksandra}
\CommentTok{#setwd( '/Users/aleksandraconevska/Dropbox/Harvard/2020/Fall2020/Gov-2001/Replication-Paper/Replication/data/processed/VOTING/')}

\CommentTok{#María}

\CommentTok{##### seeing how result change OK original vs Ok replaced}
\KeywordTok{attach}\NormalTok{(votefire_}\DecValTok{1620}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## The following object is masked _by_ .GlobalEnv:
## 
##     FullPrc
\end{verbatim}

\begin{verbatim}
## The following objects are masked from votefire_2:
## 
##     AFCount, age18_30, age30_45, age45_65, age65plus, BAAcresSum,
##     ballotscast, ballotscast2016, ballotscast2020, BAPrecPct, BASqMSum,
##     BAWithin0to5km, BAWithin10to15km, BAWithin15to20km,
##     BAWithin20to25km, BAWithin25to30km, BAWithin30to35km,
##     BAWithin35to40km, BAWithin5to10km, BAWithinOver40km, cocountyname,
##     CountyCd, CountyCode, CountyName, crit_work, exposure, fem,
##     fem_voted, fid, FIPS, FullPrc, gender_unknown, male, male_voted,
##     pop, PrcCode, PrecAreaSqM, preccodesource, PrecDist5000Fire_km,
##     PrecDistTo5000Fire, precinctcode, PrecinctCode, precinctname,
##     PrecinctPart, proximity, regvoters, regvoters2016, regvoters2020,
##     remindex, State, turnout2016, turnout2020, unique, urban, WHPMean,
##     X, young_voted
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{## This looks sus? idk why there are so many < 1}
\KeywordTok{plot}\NormalTok{(}\DataTypeTok{x =}\NormalTok{ PrecDist5000Fire_km, }\DataTypeTok{y =}\NormalTok{ turnout2020)}
\end{Highlighting}
\end{Shaded}

\includegraphics{votefire_analysis_turnout_files/figure-latex/unnamed-chunk-9-1.pdf}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{### our standard errors are much larger for the clustered model, so i'll try transformations}

\CommentTok{############ getting rid of precincts with turnout higher than one to check results}

\CommentTok{# model t1-  continuous iv, no turnout trend, covid controls,  no fixed effects w/o precincts with turnout greater than 1}
\NormalTok{test<-}\StringTok{ }\NormalTok{votefire_}\DecValTok{1620} \OperatorTok{%>%}\StringTok{ }\KeywordTok{filter}\NormalTok{(turnout2020 }\OperatorTok{<=}\DecValTok{1}\NormalTok{)}

\KeywordTok{ggplot}\NormalTok{(test)}\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{geom_point}\NormalTok{(}\KeywordTok{aes}\NormalTok{(}\DataTypeTok{x =}\NormalTok{ PrecDist5000Fire_km, }\DataTypeTok{y =}\NormalTok{ turnout2020), }\DataTypeTok{color =} \StringTok{"orangered3"}\NormalTok{, }\DataTypeTok{alpha =} \FloatTok{.4}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{xlim}\NormalTok{(}\DecValTok{0}\NormalTok{,}\DecValTok{300}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{ggtitle}\NormalTok{(}\StringTok{"Precinct Turnout Percentage by Distance from Nearest Fire (KM)"}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{xlab}\NormalTok{(}\StringTok{"Distance from Nearest Fire (KM)"}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{ylab}\NormalTok{(}\StringTok{"Precinct Turnout Percentage"}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{geom_smooth}\NormalTok{(}\DataTypeTok{method =} \StringTok{"lm"}\NormalTok{, }\KeywordTok{aes}\NormalTok{(}\DataTypeTok{x =}\NormalTok{ PrecDist5000Fire_km, }\DataTypeTok{y =}\NormalTok{ turnout2020), }\DataTypeTok{color =} \StringTok{"black"}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{theme_bw}\NormalTok{() }\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{theme}\NormalTok{(}\DataTypeTok{plot.title =} \KeywordTok{element_text}\NormalTok{(}\DataTypeTok{hjust =} \FloatTok{0.5}\NormalTok{)) }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## `geom_smooth()` using formula 'y ~ x'
\end{verbatim}

\begin{verbatim}
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
\end{verbatim}

\begin{verbatim}
## Warning: Removed 1 rows containing missing values (geom_point).
\end{verbatim}

\includegraphics{votefire_analysis_turnout_files/figure-latex/unnamed-chunk-9-2.pdf}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#ggsave("TurnoutByFireDistance_Test.jpeg", path = "/Users/ethan/Dropbox (Harvard University)/Replication/output/Figures")}

\NormalTok{t1 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban }\OperatorTok{+}\StringTok{ }\NormalTok{pop,}
  \DataTypeTok{data =}\NormalTok{ test}
\NormalTok{) }

\NormalTok{dfat1 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{t1}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcovt1 <-}\StringTok{ }\NormalTok{dfat1 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(t1, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{t1_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(t1, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcovt1)}\CommentTok{# run models with clustered SE}
\CommentTok{#}

                       

\CommentTok{### trying models with new values of OK}
\CommentTok{# model t1-  continuous iv, no turnout trend, covid controls,  no fixed effects w/o precincts with turnout greater than 1}

\NormalTok{t2 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{(}
\NormalTok{  turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{urban,}
  \DataTypeTok{data =}\NormalTok{ votefire_}\DecValTok{2}
\NormalTok{) }

\NormalTok{dfat2 <-}\StringTok{ }\NormalTok{(G}\OperatorTok{/}\NormalTok{(G }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)) }\OperatorTok{*}\StringTok{ }\NormalTok{(N }\OperatorTok{-}\StringTok{ }\DecValTok{1}\NormalTok{)}\OperatorTok{/}\NormalTok{t2}\OperatorTok{$}\NormalTok{df.residual}\CommentTok{#computing df adjustment for clustered SE }
\NormalTok{firm_c_vcovt2 <-}\StringTok{ }\NormalTok{dfat2 }\OperatorTok{*}\StringTok{ }\KeywordTok{vcovHC}\NormalTok{(t2, }\DataTypeTok{type =} \StringTok{"HC0"}\NormalTok{, }\DataTypeTok{cluster =} \StringTok{"group"}\NormalTok{, }\DataTypeTok{adjust =}\NormalTok{ T) }\CommentTok{# display with cluster VCE and df-adjustment}
\NormalTok{t2_r <-}\StringTok{ }\KeywordTok{coeftest}\NormalTok{(t2, }\DataTypeTok{vcov =}\NormalTok{ firm_c_vcovt2)}\CommentTok{# run models with clustered SE}


\CommentTok{## Turnout }



\CommentTok{# QQ plot}

\KeywordTok{qplot}\NormalTok{(}\DataTypeTok{sample =}\NormalTok{ PrecDist5000Fire_km, }\DataTypeTok{na.rm =} \OtherTok{TRUE}\NormalTok{, }\DataTypeTok{color =} \KeywordTok{I}\NormalTok{(}\StringTok{"orangered3"}\NormalTok{), }\DataTypeTok{alpha =} \FloatTok{.4}\NormalTok{) }\OperatorTok{+}
\StringTok{      }\KeywordTok{ylab}\NormalTok{(}\StringTok{"Precinct Distance from Fire, KM"}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{      }\KeywordTok{xlab}\NormalTok{(}\StringTok{"Theoretical Quantiles"}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{      }\KeywordTok{ggtitle}\NormalTok{(}\StringTok{"Normal Q-Q Plot, Precinct District from Fire (KM) "}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{      }\KeywordTok{geom_abline}\NormalTok{(}\DataTypeTok{intercept =} \KeywordTok{max}\NormalTok{(PrecDist5000Fire_km, }\DataTypeTok{na.rm =} \OtherTok{TRUE}\NormalTok{)}\OperatorTok{/}\DecValTok{2}\NormalTok{, }\DataTypeTok{slope =} \KeywordTok{max}\NormalTok{(PrecDist5000Fire_km, }\DataTypeTok{na.rm =} \OtherTok{TRUE}\NormalTok{)}\OperatorTok{/}\DecValTok{8}\NormalTok{) }\OperatorTok{+}
\StringTok{      }\KeywordTok{theme_bw}\NormalTok{() }\OperatorTok{+}\StringTok{ }
\StringTok{      }\KeywordTok{theme}\NormalTok{(}\DataTypeTok{legend.position =} \StringTok{"none"}\NormalTok{) }\OperatorTok{+}\StringTok{ }
\StringTok{      }\KeywordTok{theme}\NormalTok{(}\DataTypeTok{plot.title =} \KeywordTok{element_text}\NormalTok{(}\DataTypeTok{hjust =} \FloatTok{0.5}\NormalTok{)) }
\end{Highlighting}
\end{Shaded}

\includegraphics{votefire_analysis_turnout_files/figure-latex/unnamed-chunk-9-3.pdf}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#ggsave("QQ.jpeg", path = "/Users/ethan/Dropbox (Harvard University)/Replication/output/Figures")}


\CommentTok{## RESIDUALS PLOT}

\KeywordTok{ggplot}\NormalTok{(m4) }\OperatorTok{+}
\StringTok{  }\KeywordTok{aes}\NormalTok{(m4}\OperatorTok{$}\NormalTok{model}\OperatorTok{$}\NormalTok{PrecDist5000Fire_km, m4}\OperatorTok{$}\NormalTok{residuals, }\DataTypeTok{color =} \KeywordTok{I}\NormalTok{(}\StringTok{"orangered3"}\NormalTok{), }\DataTypeTok{alpha =} \FloatTok{.4}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{geom_point}\NormalTok{() }\OperatorTok{+}
\StringTok{  }\KeywordTok{geom_hline}\NormalTok{(}\KeywordTok{aes}\NormalTok{(}\DataTypeTok{yintercept =} \DecValTok{0}\NormalTok{, }\DataTypeTok{color =}\StringTok{"black"}\NormalTok{)) }\OperatorTok{+}
\StringTok{  }\KeywordTok{xlab}\NormalTok{(}\StringTok{"Predicted Precinct Distance from Nearest Fire (KM)"}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{ylab}\NormalTok{(}\StringTok{"Residuals"}\NormalTok{) }\OperatorTok{+}
\StringTok{  }\KeywordTok{scale_y_continuous}\NormalTok{(}\DataTypeTok{limits =} \KeywordTok{c}\NormalTok{(}\OperatorTok{-}\NormalTok{.}\DecValTok{9}\NormalTok{, }\FloatTok{.3}\NormalTok{), }\DataTypeTok{breaks =} \KeywordTok{c}\NormalTok{(}\OperatorTok{-}\NormalTok{.}\DecValTok{9}\NormalTok{, }\FloatTok{-.6}\NormalTok{, }\FloatTok{-.3}\NormalTok{, }\DecValTok{0}\NormalTok{, }\FloatTok{.3}\NormalTok{)) }\OperatorTok{+}
\StringTok{  }\KeywordTok{theme_bw}\NormalTok{() }\OperatorTok{+}\StringTok{ }
\StringTok{  }\KeywordTok{theme}\NormalTok{(}\DataTypeTok{legend.position =} \StringTok{"none"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\includegraphics{votefire_analysis_turnout_files/figure-latex/unnamed-chunk-9-4.pdf}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{#ggsave("Residuals.jpg", path = "/Users/ethan/Dropbox (Harvard University)/Replication/output/Figures")}



\CommentTok{## Trying distance measure transformations  }
\CommentTok{#votefire2_complete$PrecDist5000Fireksq <- sqrt(PrecDist5000Fire_km)}

\CommentTok{#votefire2_complete$PrecDist5000Fireksq2 <- PrecDist5000Fire_km^2}

\CommentTok{#attach(votefire2_complete)}

\CommentTok{#is.na(votefire2_complete$PrecDist5000Fire_km) <- votefire2_complete$PrecDist5000Fire_km == "0"}
\CommentTok{#is.na(votefire2_complete$PrecDist5000Fire_km) <- votefire2_complete$PrecDist5000Fire_km < "1"}


\CommentTok{#m <- lm(turnout2020 ~ PrecDist5000Fire_km, data = votefire2_complete) }
  
\CommentTok{#MASS::boxcox(PrecDist5000Fire_km, lambda = seq(-0.25, 0.75, by = 0.05), plotit = TRUE)}
\CommentTok{#MASS::boxcox(turnout2020 ~ PrecDist5000Fire_km)}

\CommentTok{#car::boxCox(PrecDist5000Fire_km, lambda = seq(-0.25, 0.5, 1/10), plotit = TRUE)}


\CommentTok{#distance <- votefire2_complete %>%}
                   \CommentTok{# dplyr::select(c("PrecDist5000Fire_km")) }

\CommentTok{#MASS::boxcox(, lambda = "auto")}



\CommentTok{## RESIDUALS AND QQ PLOT POST TRANSFORM}

\CommentTok{#m4t <-  lm(}
\CommentTok{# turnout2020 ~ PrecDist5000Fire_km  + WHPMean + crit_work +}
 \CommentTok{#   remindex + proximity + exposure + urban + pop,}
 \CommentTok{# data = votefire2_complete}
\CommentTok{#) }

\CommentTok{## (ethan) -- I still need to get these to work}

\CommentTok{#Res plot}
\CommentTok{#ggplot(m4t) +}
\CommentTok{#  aes(m4t$model$PrecDist5000Fireksq, m4t$residuals, color = I("orangered3"), alpha = .4) +}
\CommentTok{# geom_point() +}
\CommentTok{#  geom_hline(aes(yintercept = 0, color ="black")) +}
\CommentTok{#  xlab("Predicted Precinct Distance from Nearest Fire (KM)") +}
\CommentTok{# ylab("Residuals") +}
\CommentTok{#  scale_y_continuous(limits = c(-.9, .3), breaks = c(-.9, -.6, -.3, 0, .3)) +}
 \CommentTok{# theme_bw() + }
 \CommentTok{# theme(legend.position = "none")}

\CommentTok{#ggsave("Transformed_Residuals.jpeg", path = "/Users/ethan/Dropbox (Harvard University)/Replication/output/Figures")}


\CommentTok{#QQ plot}
\CommentTok{#qplot(}
\CommentTok{#  sample = PrecDist5000Fireksq2,}
\CommentTok{#  na.rm = TRUE,}
\CommentTok{#  color = I("orangered3"),}
\CommentTok{##  alpha = .4}
\CommentTok{#) +}
\CommentTok{#  ylab("Precinct Distance from Fire, KM") +}
\CommentTok{#  xlab("Theoretical Quantiles") +}
 \CommentTok{# ggtitle("Normal Q-Q Plot, Precinct District from Fire (KM) ") +}
\CommentTok{# geom_abline(}
 \CommentTok{#   intercept = max(PrecDist5000Fireksq2, na.rm = TRUE) / 2,}
 \CommentTok{#   slope = max(PrecDist5000Fireksq2, na.rm = TRUE) / 8}
 \CommentTok{# ) +}
\CommentTok{#  theme_bw() +}
\CommentTok{#  theme(legend.position = "none") +}
 \CommentTok{# theme(plot.title = element_text(hjust = 0.5)) }

\CommentTok{#ggsave("Transformed_QQ.jpeg", path = "/Users/ethan/Dropbox (Harvard University)/Replication/output/Figures")}
\end{Highlighting}
\end{Shaded}

\hypertarget{why-is-our-coefficient-flipping-different-versions-of-our-baseline-model}{%
\subsubsection{Why is our coefficient flipping? Different versions of
our baseline
model}\label{why-is-our-coefficient-flipping-different-versions-of-our-baseline-model}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{### first version no clusters no controls}
\NormalTok{mt1 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se1 <-}\StringTok{ }\KeywordTok{coef}\NormalTok{(}\KeywordTok{summary}\NormalTok{(mt1))[,}\DecValTok{2}\NormalTok{]}

\CommentTok{### no controls clusters}
\NormalTok{mt2 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se2 <-}\StringTok{ }\KeywordTok{starprep}\NormalTok{(mt2, }\DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{)}

\CommentTok{### clusters and covid controls}

\NormalTok{mt3 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se3 <-}\StringTok{ }\KeywordTok{starprep}\NormalTok{(mt3, }\DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{)}

\CommentTok{### clusters and urban controls}

\NormalTok{mt4 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\NormalTok{urban,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se4 <-}\StringTok{ }\KeywordTok{starprep}\NormalTok{(mt4, }\DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{)}

\CommentTok{## clusters, urban controls and covid controls. }

\NormalTok{mt5 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\NormalTok{urban}\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se5 <-}\StringTok{ }\KeywordTok{starprep}\NormalTok{(mt5, }\DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{)}

\CommentTok{## clusters, trend controls}

\NormalTok{mt6 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{turnout2016,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se6 <-}\StringTok{ }\KeywordTok{starprep}\NormalTok{(mt6, }\DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{)}

\CommentTok{## clusters, urban controls, trend controls,  and covid controls. }

\NormalTok{mt7 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean }\OperatorTok{+}\StringTok{ }\NormalTok{pop }\OperatorTok{+}\StringTok{ }\NormalTok{urban}\OperatorTok{+}\StringTok{ }\NormalTok{crit_work }\OperatorTok{+}
\StringTok{    }\NormalTok{remindex }\OperatorTok{+}\StringTok{ }\NormalTok{proximity }\OperatorTok{+}\StringTok{ }\NormalTok{exposure }\OperatorTok{+}\StringTok{ }\NormalTok{turnout2016,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se7 <-}\StringTok{ }\KeywordTok{starprep}\NormalTok{(mt7, }\DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{)}

\CommentTok{## clusters and fixed effects}

\NormalTok{mt8 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean  }\OperatorTok{+}\StringTok{ }\KeywordTok{factor}\NormalTok{(CountyCd) }\OperatorTok{+}\StringTok{ }\NormalTok{turnout2016,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se8 <-}\StringTok{ }\KeywordTok{starprep}\NormalTok{(mt8, }\DataTypeTok{clusters =}\NormalTok{ votefire2_complete}\OperatorTok{$}\NormalTok{FullPrc, }\DataTypeTok{se_type =} \StringTok{"stata"}\NormalTok{)}

\CommentTok{## no clusters and fixed effects}

\NormalTok{mt9 <-}\StringTok{  }\KeywordTok{lm}\NormalTok{( turnout2020 }\OperatorTok{~}\StringTok{ }\NormalTok{PrecDist5000Fire_km  }\OperatorTok{+}\StringTok{ }\NormalTok{WHPMean  }\OperatorTok{+}\StringTok{  }\KeywordTok{factor}\NormalTok{(CountyCd) }\OperatorTok{+}\StringTok{ }\NormalTok{turnout2016,}
        \DataTypeTok{data =}\NormalTok{ votefire2_complete) }

\NormalTok{se9 <-}\StringTok{ }\KeywordTok{coef}\NormalTok{(}\KeywordTok{summary}\NormalTok{(mt9))[,}\DecValTok{2}\NormalTok{]}

\KeywordTok{stargazer}\NormalTok{(mt1,mt2, mt3, mt4, mt5, mt6, mt7, mt8, mt9, }
           \DataTypeTok{se =} \KeywordTok{c}\NormalTok{(se1, se2, se3, se4, se5, se6, se7, se8, se9),}
          \DataTypeTok{header =} \OtherTok{FALSE}\NormalTok{,}
          \DataTypeTok{df=}\OtherTok{FALSE}\NormalTok{, }
          \DataTypeTok{style =} \StringTok{"apsr"}\NormalTok{,}
          \DataTypeTok{title =} \StringTok{"Main result with different measure of fire exposure"}\NormalTok{,}
          \DataTypeTok{keep =} \KeywordTok{c}\NormalTok{(}\StringTok{"Intercept"}\NormalTok{, }\StringTok{"PrecDist5000Fire_km"}\NormalTok{, }\StringTok{"urban"}\NormalTok{, }\StringTok{"pop"}\NormalTok{, }\StringTok{"crit_work"}\NormalTok{,}
                    \StringTok{"remindex"}\NormalTok{ , }\StringTok{"proximity"}\NormalTok{ , }\StringTok{"exposure"}\NormalTok{ ),}
          \DataTypeTok{add.lines =} \KeywordTok{list}\NormalTok{(}\KeywordTok{c}\NormalTok{(}\StringTok{"County FE"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{), }
                           \KeywordTok{c}\NormalTok{(}\StringTok{"Covid Controls"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{), }
                           \KeywordTok{c}\NormalTok{(}\StringTok{"Trend Controls"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{), }
                           \KeywordTok{c}\NormalTok{(}\StringTok{"Urban Controls"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{""}\NormalTok{), }
                           \KeywordTok{c}\NormalTok{(}\StringTok{"Clusters"}\NormalTok{, }\StringTok{""}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{"X"}\NormalTok{, }\StringTok{""}\NormalTok{)),}
          \DataTypeTok{covariate.labels =} \KeywordTok{c}\NormalTok{(}\StringTok{"Distance to nearest fire"}\NormalTok{),}
          \DataTypeTok{dep.var.caption =} \StringTok{"Turnout 2020 (mean = ; sd = 0."}\NormalTok{,}
          \DataTypeTok{keep.stat =} \KeywordTok{c}\NormalTok{(}\StringTok{"rsq"}\NormalTok{, }\StringTok{"n"}\NormalTok{),}
          \DataTypeTok{digits =} \DecValTok{3}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{table}[!htbp] \centering 
  \caption{Main result with different measure of fire exposure} 
  \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lccccccccc} 
\\[-1.8ex]\hline \\[-1.8ex] 
\\[-1.8ex] & \multicolumn{9}{c}{turnout2020} \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9)\\ 
\hline \\[-1.8ex] 
 Distance to nearest fire & 0.0001 & 0.0001 & 0.0001 & 0.0001$^{***}$ & 0.0002$^{***}$ & 0.0001$^{***}$ & 0.0001$^{***}$ & $-$0.0003$^{***}$ & $-$0.0003$^{***}$ \\ 
  &  &  &  & (0.00002) & (0.00003) & (0.00002) & (0.00003) & (0.00002) & (0.00002) \\ 
  crit\_work &  &  & $-$0.027 &  & 0.102$^{***}$ &  & 0.069$^{*}$ &  &  \\ 
  &  &  &  &  & (0.039) &  & (0.038) &  &  \\ 
  remindex &  &  & 0.066 &  & 0.185$^{***}$ &  & 0.104$^{***}$ &  &  \\ 
  &  &  &  &  & (0.015) &  & (0.021) &  &  \\ 
  proximity &  &  & $-$0.014 &  & $-$0.068$^{**}$ &  & 0.024 &  &  \\ 
  &  &  &  &  & (0.028) &  & (0.037) &  &  \\ 
  exposure &  &  & $-$0.015 &  & $-$0.139$^{***}$ &  & $-$0.085$^{**}$ &  &  \\ 
  &  &  &  &  & (0.028) &  & (0.033) &  &  \\ 
  pop &  &  &  & 0.000 & $-$0.00000 &  & $-$0.000$^{***}$ &  &  \\ 
  &  &  &  &  &  &  & (0.000) &  &  \\ 
  urban &  &  &  & $-$0.009 & $-$0.017 &  & $-$0.005 &  &  \\ 
  &  &  &  &  &  &  & (0.005) &  &  \\ 
 County FE &  &  &  &  &  &  &  & X & X \\ 
Covid Controls &  &  & X &  & X &  & X &  &  \\ 
Trend Controls &  &  &  &  &  & X & X &  &  \\ 
Urban Controls &  &  &  & X & X &  & X &  &  \\ 
Clusters &  & X & X & X & X & X & X & X &  \\ 
N & 6,768 & 6,768 & 6,768 & 6,768 & 6,768 & 6,768 & 6,768 & 6,768 & 6,768 \\ 
R$^{2}$ & 0.010 & 0.010 & 0.040 & 0.031 & 0.051 & 0.401 & 0.410 & 0.443 & 0.443 \\ 
\hline \\[-1.8ex] 
\multicolumn{10}{l}{$^{*}$p $<$ .1; $^{**}$p $<$ .05; $^{***}$p $<$ .01} \\ 
\end{tabular} 
\end{table}

\end{document}
